package com.khh.base.util;

import java.util.Date;

public abstract class Clock {

	public static DateGenerator dateGenerator = new DefaultDateGenerator();

	public interface DateGenerator {
		Date getCurrentTime();

		long getCurrentTimeMillis();
	}

	public static class DefaultDateGenerator implements DateGenerator {
		public Date getCurrentTime() {
			return new Date();
		}

		public long getCurrentTimeMillis() {
			return System.currentTimeMillis();
		}
	}

	public static Date getCurrentTime() {
		return dateGenerator.getCurrentTime();
	}

	public static long getCurrentTimeMillis() {
		return dateGenerator.getCurrentTimeMillis();
	}
}
